package com.supply.supplymanage.controller;

import com.github.pagehelper.PageInfo;
import com.supply.supplymanage.biz.FrpruBiz;
import com.supply.supplymanage.entity.Frpru;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("frpru")
public class FrpruController {
    @Resource
    private FrpruBiz frpruBiz;
    //分页查询已审核订单
    @RequestMapping("/queryfrpru/{pageNum}")
    @ResponseBody
    public PageInfo queryfrpru(@PathVariable("pageNum") int pageNum){
        PageInfo pageInfo = frpruBiz.queryfrpru(pageNum);
        return pageInfo;
    }
    //分页查询未审核订单
    @RequestMapping("/queryfrpru2/{pageNum}")
    @ResponseBody
    public PageInfo queryfrpru2(@PathVariable("pageNum") int pageNum){
        PageInfo pageInfo = frpruBiz.queryfrpru2(pageNum);
        return pageInfo;
    }
    //供应商查询
    @RequestMapping("/supnameAll")
    @ResponseBody
    public PageInfo seleExAll(@RequestParam("PageNum") int PageNum, @RequestParam("supname")String supname){
        //System.out.println(supname);
        PageInfo pageInfo = frpruBiz.supnameAll(PageNum,supname);
        return pageInfo;
    }
    //仓库查询
    @RequestMapping("/entrynameAll")
    @ResponseBody
    public PageInfo entrynameAll(@RequestParam("PageNum") int PageNum, @RequestParam("entryname")String entryname){
        PageInfo pageInfo = frpruBiz.entrynameAll(PageNum,entryname);
        return pageInfo;
    }
    //删除
    @RequestMapping("/delfrpru/{frpid}")
    @ResponseBody
    public String delfrpru(@PathVariable("frpid") int frpid){
        frpruBiz.delfrpru(frpid);
        return "forward:queryfrpru";
    }
    //查询详情
    @RequestMapping("/queryfrpruOne/{frpid}")
    public @ResponseBody
    List<Map> queryfrpruOne(@PathVariable("frpid") Integer frpid){
        List<Map> list= frpruBiz.queryfrpruOne(frpid);
       // System.out.println("编号"+frpid);
        return list;
    }
    //修改未审核
    @RequestMapping("/checked1/{frpid}")
    @ResponseBody
    public String checked1(@PathVariable("frpid") Integer frpid){
       // System.out.println(frpid+"======");
        frpruBiz.checked1(frpid);
        return null;
    }
    //修改已审核
    @RequestMapping("/updateaudit/{frpid}")
    @ResponseBody
    public String updateaudit(@PathVariable("frpid") Integer frpid){
      //  System.out.println(frpid+"======");
        frpruBiz.updateaudit(frpid);
        return null;
    }
    //添加
    @RequestMapping("/addfrpru")
    public void addfrpru(Frpru frpru){
        frpruBiz.addfrpru(frpru);
    };
    //查询仓库
    @RequestMapping("/queryfrpruentrepot")
    public @ResponseBody List<Map> queryfrpruentrepot(){
        return frpruBiz.queryfrpruentrepot();
    };
    //查询供货商
    @RequestMapping("/queryfrprusupplier")
    public @ResponseBody List<Map> queryfrprusupplier(){
        return frpruBiz.queryfrprusupplier();
    };
    //查询进货人
    @RequestMapping("/queryfrpruclient")
    public @ResponseBody List<Map> queryfrpruclient(){
        return frpruBiz.queryfrpruclient();
    };
}






